package com.sh.data.engine.application.model.request.integration;

import com.sh.data.engine.common.annotation.crypto.EncryptField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author: mengzheng.mhc
 * @date: 2024/6/5 17:42
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema
public class DataSourceRdbmsSaveRequest extends DataSourceSaveRequest {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Schema(description = "用户名")
    private String username;

    /**
     * 数据源JDBC连接
     */
    @NotBlank(message = "dsLink不能为空")
    @Schema(description = "jdbc连接", requiredMode = Schema.RequiredMode.REQUIRED)
    private String dsLink;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Schema(description = "密码")
    @EncryptField
    private String password;

    /**
     * 服务器
     */
    @NotBlank(message = "服务器不能为空")
    @Schema(description = "服务器")
    private String server;

    /**
     * 端口
     */
    @NotNull(message = "端口不能为空")
    @Min(value = 0, message = "端口不能小于0")
    @Max(value = 65535, message = "端口不能大于65535")
    @Schema(description = "端口")
    private Integer port = 0;

    /**
     * 数据库
     */
    @Schema(description = "数据库")
    private String dbName;

    /**
     * oracle数据库连接类型 0-sid 1-service name
     */
    @Schema(description = "oracle数据库连接类型 0-sid 1-service name")
    private Integer oracleConnectionType;

    /**
     * 数据库模式
     */
    @Schema(description = "pg schema")
    private String schema;
}
